# Contributor: Jeremy Thomerson <jeremy@thomersonfamily.com>
# Maintainer: Jeremy Thomerson <jeremy@thomersonfamily.com>
pkgname=rdiff-backup
pkgver=2.0.5
pkgrel=5
pkgdesc="Reverse differential backup tool"
# Requires unpackaged 'xattr'
options="!check"
url="https://rdiff-backup.net/"
arch="all"
license="GPL-2.0-or-later"
depends="python3"
makedepends="librsync-dev python3-dev py3-setuptools"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion:bashcomp:noarch
	"
source="https://github.com/rdiff-backup/rdiff-backup/releases/download/v$pkgver/rdiff-backup-$pkgver.tar.gz
	0001-Resolve-runtime-dependency-on-setuptools-to-get-vers.patch
	0002-remove-setuptools_scm.patch
	0003-fix-version.patch
	"

prepare() {
	default_prepare
	sed -e "s/%%PKGVER%%/$pkgver/" \
		-i setup.cfg
}

build() {
	python3 setup.py build
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

bashcomp() {
	depends=""
	pkgdesc="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	amove usr/share/bash-completion
}

sha512sums="
59482e6d78bc887fc99efd4b4779e9b41c7e4b0427e51b80b18a550d0051e4213a0c200296154759d1734f511f7abe3175d171f018c59c55e5abdfd0a890cfbd  rdiff-backup-2.0.5.tar.gz
10788ac9ab17849e3f22a4fcfc9b7cd4ea528067591c00f58fb2f41fbb5773e904665d116d92f21fada4b18147e5d1eb31a042be011021a280e2cb87f6683ed0  0001-Resolve-runtime-dependency-on-setuptools-to-get-vers.patch
4130fd33ab9048e266f7c9a3c0d069e45df27a7a1cf31265c035e8b75f4283d675624064e6a181e2c282b2d2b91975ae07564a37c2ff60f48e46aeae0f7bc120  0002-remove-setuptools_scm.patch
236314c5d51d600abbfb55f084b47e0d60e3182be69803bb0abeff50e0d8750ab29b603abbf39b1a6aa94fe7a6593e121abb330bb8a348fcc27c7a0c3f4bed0b  0003-fix-version.patch
"
